package asruby.runtime.component {

import asruby.runtime.buildin.Variable;
import asruby.util.IdUtil;

public class VariableEntry implements Variable {
    public  var name:String;
    public  var value:Object;
    
    public  function VariableEntry(name:String, value:Object){
        //var name: assert = = name.intern() : name + " is not interned";
        this.name = name;
        this.value = value;
    }

    public  function getName():String{
        return name;
    }
    
    public  function getValue():Object{
        return value;
    }
    
    public  function isClassVariable():Boolean{
        return IdUtil.isClassVariable(name);
    }
    
    public  function isConstant():Boolean{
        return IdUtil.isConstant(name);
    }
    
    public  function isInstanceVariable():Boolean{
        return IdUtil.isInstanceVariable(name);
    }

    public  function isRubyVariable():Boolean{
        var c:String;
        return name.length > 0 && ((c = name.charAt(0)) == '@' || (c <= 'Z' && c >= 'A'));
    }
}
}